package com.boot.dto;

import lombok.Data;
import org.camunda.bpm.engine.runtime.ProcessInstance;

@Data
public class ProcessInstanceDto {
    private String id;
    private String businessKey;
    private String processDefinitionId;
    private boolean ended;
    private boolean suspended;

    public static ProcessInstanceDto from(ProcessInstance instance) {
        ProcessInstanceDto dto = new ProcessInstanceDto();
        dto.setId(instance.getId());
        dto.setBusinessKey(instance.getBusinessKey());
        dto.setProcessDefinitionId(instance.getProcessDefinitionId());
        dto.setEnded(instance.isEnded());
        dto.setSuspended(instance.isSuspended());
        return dto;
    }
}
